const { exec,excape } = require('../db/mysql')
const { genPassword } = require('../utils/cryp')

const login = async (username,password)=>{
    username = excape(username)
    password = genPassword(password)
    console.log(username,password,'username,password')
    password = excape(password)
    let sql = `select username,realname from users where username=${username} and password=${password}`
    const rows = await exec(sql)
    console.log(rows,'rows')
    return rows[0] || {}
}

module.exports = {
    login
}
        